<template>
  <div class="base_pop">
    <div class="contain">
      <header class="header" :class="colorObj">{{ title }}</header>
      <main class="main">{{ content }}</main>
      <footer class="footer" :class="colorObj">
        <button @click="emit('cancel')">取消</button>
        <button @click="emit('confirm')">确认</button>
      </footer>
    </div>
  </div>
</template>

<script setup lang="ts">
const emit = defineEmits(["cancel", "confirm"]);
const props = defineProps({
  title: {
    type: String,
  },
  content: {
    type: String,
  },
  color: {
    type: String,
  },
});

const colorObj = {
  blue: props.color == "blue",
  pink: props.color == "pink",
};
</script>
<style lang="scss" scoped>
.base_pop {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  display: flex;
  justify-content: center;
  align-items: center;

  .contain {
    width: 270px;
    height: 350px;
    background-color: white;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    .blue {
      background-color: blue;
    }
    .pink {
      background-color: pink;
    }
    .header {
      height: 40px;
      display: flex;
      align-items: center;
    }
    .main {
      flex: 1;
    }
    .footer {
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: space-around;
    }
  }
}
</style>
